package com.aloha.springframework.beans.factory;

import com.aloha.springframework.beans.BeansException;

/**
 * @author DaiZhiHeng
 * @description 对象工厂的总接口
 * @date 2023/6/27 21:48
 */
public interface BeanFactory {

    /**
     * 获取 Bean 对象
     *
     * @param name BeanName
     */
    Object getBean(String name) throws BeansException;

    /**
     * 获取 Bean 对象
     *
     * @param name BeanName
     * @param args Bean对象构造方法的参数
     */
    Object getBean(String name, Object... args) throws BeansException;

    /**
     * 获取 Bean 对象
     *
     * @param name         BeanName
     * @param requiredType Bean对象的类型
     */
    <T> T getBean(String name, Class<T> requiredType) throws BeansException;

    <T> T getBean(Class<T> requiredType) throws BeansException;

    boolean containsBean(String name);

}
